<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <meta name="wap-font-scale" content="no">  <!--解决UC字体忽然变大-->
    <meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1">
    
        <?php if(!empty($page["title"])): ?><title><?php echo ($page["title"]); ?></title>
            <?php else: ?>
            <title><?php echo ($setting["sitename"]); ?></title><?php endif; ?>
    
    <?php if(!empty($page["keywords"])): ?><meta name="keywords" content="<?php echo ($page["keywords"]); ?>"/>
        <?php else: ?>
        <meta name="keywords" content="<?php echo ($setting["keywords"]); ?>"/><?php endif; ?>
    <?php if(!empty($page["description"])): ?><meta property="description" name="description" content="<?php echo ($page["description"]); ?>"/>
        <?php else: ?>
        <meta property="description" name="description" content="<?php echo ($setting["description"]); ?>"/><?php endif; ?>

    
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--bootstrap组件--><link rel="stylesheet" href="/Public/bootstrap/bootstrap.min.css" ><script src="/Public/bootstrap/jquery.min.js" ></script><script src="/Public/bootstrap/popper.min.js"></script><script src="/Public/bootstrap/bootstrap.min.js"></script><!--awesome字体--><link href="/Public/bootstrap/font/css/font-awesome.min.css" rel="stylesheet"><!--bootstrap-dialog--><script src="/Public/bootstrap/bootstrap.dialog.js"></script><!--拖拽--><!--<script type="text/javascript" src="/Public/Plugs/jq/jquery-ui.min.js"></script>--><!--文件上传--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/uploadify/uploadify.css"><script type="text/javascript" src="/Public/Plugs/uploadify/jquery.uploadify.min.js"></script>--><!--滚动条--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.css"/><script type="text/javascript" src="/Public/Plugs/mCustomScrollbar/jquery.mCustomScrollbar.js"></script>--><!--颜色选择器--><link rel="stylesheet" type="text/css" href="/Public/Plugs/spectrum/spectrum.css"><script type="text/javascript" src="/Public/Plugs/spectrum/spectrum.js"></script><!--弹出框--><script type="text/javascript" src="/Public/Plugs/jq/jquery-dialog.js"></script><!--新日历控件,来源  http://blog.csdn.net/binyao02123202/article/details/42066035--><!--<link rel="stylesheet" type="text/css" href="/Public/Plugs/calendar/cxcalendar.css"/><script type="text/javascript" src="/Public/Plugs/calendar/calendar.js"></script>--><!--日期选择器插件datetimepicker--><link rel="stylesheet" href="/Public/Plugs/flatpickr/flatpickr.min.css"><script type="text/javascript" src="/Public/Plugs/flatpickr/flatpickr.js"></script><script type="text/javascript" src="/Public/Plugs/flatpickr/zh.js?v=3"></script><!--文件上传-插件地址：https://github.com/danielm/uploader--><script src="/Public/Plugs/dmuploader/jquery.dm-uploader.js"></script><!--ueditor--><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.config.js"></script><script type="text/javascript" src="/Public/Plugs/ueditor/ueditor.all.js"></script><link rel="stylesheet" type="text/css" href="/Public/Plugs/ueditor/third-party/video-js/video-js.css"><script type="text/javascript" src="/Public/Plugs/ueditor/third-party/video-js/video.js"></script><!--app--><link rel="stylesheet" type="text/css" href="/Public/Admin/css/style.css"/><script type="text/javascript" src="/Public/Admin/js/common_admin.js"></script>
    
</head>
<body>

<div class="g-page-in">
    <div class="clearfix">    <div class="float-left">        <div class="u-breadcrumb">            <a class="back" href="javascript:window.location.reload()" ><span class="fa fa-repeat"></span> 刷新</a>            <span class="name">文章分类</span>        </div>    </div>    <div class="float-right">        <a href="#" role="button" class="btn btn-primary btn-sm" onclick="return alert_win('根目录',0);"><i class="fa fa-plus"></i> 新增顶级分类</a>    </div></div><div class="h10"></div><form action="" method="post">	<input type="hidden" name="act" value="update_order">	<table class="table table-bb">		<tr>			<th width="40">ID</th>			<th>分类名（文章数）</th>			<th>排序</th>			<!--<th>是否显示</th>-->			<th>操作</th>		</tr>		<?php if(is_array($catelist)): $i = 0; $__LIST__ = $catelist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="tr_<?php echo ($vo["id"]); ?>">				<td><?php echo ($vo["id"]); ?></td>				<td><?php echo ($vo["pre"]); ?> <a class="blue" href="<?php echo U('Article/index');?>?cate_id=<?php echo ($vo["id"]); ?>"><?php echo ($vo["name_cn"]); ?></a><?php if(($vo["is_able"]) == "1"): ?>(<?php echo ($vo["total"]); ?>)<?php else: ?><span class="c999 line-through"> <?php echo ($vo["total"]); ?></span><?php endif; ?></td>				<td>                    <div class="form-inline">					<?php echo ($vo["pre"]); ?>&nbsp;<input class="form-control form-control-sm w-40" type="text" name="sort" value="<?php echo ($vo["sort"]); ?>" old-sort="<?php echo ($vo["sort"]); ?>" data-id="<?php echo ($vo["id"]); ?>" sort-id="<?php echo ($vo["id"]); ?>" />&nbsp;                    <a class="blue" href="#" onclick="return update_sort_one(<?php echo ($vo["id"]); ?>,this)">更新</a>                    </div>				</td>				<!--<td>					<?php if(($vo["is_show"]) == "1"): ?><select class="form-control w-80" onchange="return change_is_show(<?php echo ($vo["id"]); ?>,this)">							<option selected="1" value="1">显示</option>							<option value="0">关闭</option>						</select>						<?php else: ?>						<select class="form-control w-80" onchange="return change_is_show(<?php echo ($vo["id"]); ?>,this)">							<option value="1">显示</option>							<option selected="1" value="0">关闭</option>						</select><?php endif; ?>				</td>-->				<td>                    <a class="btn btn-sm btn-outline-secondary" href="<?php echo U('ArticleCate/edit',array('id'=>$vo['id']));?>" role="button"><i class="fa fa-edit"></i> 编辑</a>                    <div class="btn-group" role="group">                        <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">                            更多                        </button>                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">                            <a class="dropdown-item" href="#" onclick="return alert_win('<?php echo ($vo["name_cn"]); ?>',<?php echo ($vo["id"]); ?>)"><i class="fa fa-plus"></i> 子分类</a>                            <a class="dropdown-item" href="#" onclick="return content_move(<?php echo ($vo["id"]); ?>,'<?php echo ($vo["name_cn"]); ?>');"><i class="fa fa-arrows"></i> 内容迁移至</a>                            <a class="dropdown-item" href="#" onclick="return cate_delete('<?php echo ($vo["id"]); ?>')"><i class="fa fa-trash"></i> 删除</a>                        </div>                    </div>				</td>			</tr><?php endforeach; endif; else: echo "" ;endif; ?>	</table></form><div>    <button type="button" class="btn btn-secondary btn-sm" onclick="return update_sort();"><i class="fa fa-sort"></i> 排序</button></div><!--内容迁移--><div id="move_content" style="display: none;">    <form id="form_move" action="<?php echo U('ajax_content_move');?>">        <div class="form-group">            <label>内容来源</label>            <span class="text-muted pl-2" id="cate_name"></span>            <input type="hidden" name="from_id" value="" id="cate_from_id">        </div>        <div class="form-group">            <label><span class="text-danger">* </span>移动至</label>            <select class="form-control" name="to_id">                <?php if(is_array($catelist)): $i = 0; $__LIST__ = $catelist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if(($vo["is_able"]) == "1"): ?><option value="<?php echo ($vo["id"]); ?>"><?php echo ($vo["pre"]); echo ($vo["name_cn"]); ?></option>                        <?php else: ?>                        <option value="<?php echo ($vo["id"]); ?>" disabled="disabled"><?php echo ($vo["pre"]); echo ($vo["name_cn"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>            </select>            <small class="form-text text-muted"></small>        </div>        <div class="h10"></div>        <div class="text-center">            <button type="submit" class="btn btn-primary">移动</button>        </div>    </form></div><!--新增分类--><div id="as" style="display: none;">    <form action="<?php echo U('ArticleCate/add');?>" method="post">        <div class="form-group">            <label>父级</label>            <span class="text-muted pl-2 js-pid"></span>        </div>        <input name="id" type="hidden" value="">        <div class="form-group">            <label for="name_cn"><span class="text-danger">* </span>分类名称</label>            <input type="text" class="form-control" id="name_cn" name="name_cn" placeholder="分类名称">            <small class="form-text text-muted">1-20个字符</small>        </div>        <div class="form-group">            <label for="name_en">英文名称</label>            <input type="text" class="form-control" id="name_en" name="name_en" placeholder="英文名称">            <small class="form-text text-muted">1-20个字符，选填</small>        </div><!--        <div class="form-group">            <label>是否显示</label>            <div>                <div class="custom-control custom-radio custom-control-inline">                    <input type="radio" id="is_show1" name="is_show" class="custom-control-input" value="1" checked>                    <label class="custom-control-label" for="is_show1">显示</label>                </div>                <div class="custom-control custom-radio custom-control-inline">                    <input type="radio" id="is_show2" name="is_show" class="custom-control-input" value="9">                    <label class="custom-control-label" for="is_show2">关闭</label>                </div>            </div>        </div>-->        <div class="h10"></div>        <div class="text-center">            <button type="submit" class="btn btn-primary">新增</button>        </div>    </form></div><script>    //弹出创建分类窗口    function alert_win(name,id){        $('.js-pid').text(name);        $('input[name=id]').val(id);        $boot.win({id:'#as','title':'新增分类'});        return false;    }	//内容迁移显示	function content_move(from_id,cate_name){		$("#cate_name").text(cate_name);		$("#cate_from_id").val(from_id);        $boot.win({id:'#move_content','title':'内容迁移'});        return false;	}	//内容迁移操作	ajax_form("#form_move",function(data){		if(data.status){			$boot.success({text:"内容迁移成功！"},function(){				window.location.reload();			});		}else{            $boot.error({text:"迁移失败！"});		}	});	//显示与否切换	function change_is_show($id,obj){		var val = $(obj).val();		$.ajax({			type:"post",			url:"<?php echo U('ajax_set_is_show');?>",			data:{id:$id,val:val},			success:function(data){				if(data['status']){					$boot.success({text:"设置成功！",delay:1200});				}else{					$boot.error({text:data['error'],delay:1200});				}			}		})		return false;	}	//删除分类提示	function cate_delete($id)	{		$boot.confirm({text:'确定删除此分类？',title:'删除分类'},function(){			$.ajax({				type:"post",				url:"<?php echo U('ArticleCate/ajax_del_cate');?>",				data:{id:$id},				success:function(data){					if(data['status']){						$boot.success({text:"删除成功！"},function(){							for(i=0;i<data.ids.length;i++){								$(".tr_"+data['ids'][i]).remove();							}						});					}else{						$boot.error({text:data['error']});					}				}			});		});		return false;	}	//更新单条排序	function update_sort_one($id,obj){		var old_sort = $(obj).prev().attr('old-sort');		var now_sort = $(obj).prev().val();		if(old_sort == now_sort){			$boot.warn({text:"请先调整排序值！"});			return false;		}else{			$.ajax({				type:"post",				url:"<?php echo U('ArticleCate/ajax_setsort');?>",				data:{id:$id,sort:now_sort},				success:function(data){					if(data['status']){						$boot.success({text:"更新成功！"},function(){							window.location = window.location;						});					}				}			});		}		return false;	}	function update_sort(){		$last_id = $("input[name=sort]").last().attr('data-id');		$("input[name=sort]").each(function(){			var $id = $(this).attr('data-id'),$sort = $(this).val(),$old_sort = $(this).attr('old_sort');			if($old_sort!=$sort){				$.ajax({					type:"post",					url:"<?php echo U('ArticleCate/ajax_setsort');?>",					data:{id:$id,sort:$sort},					success:function(data){						if(data['status'] && $id == $last_id){							$boot.success({text:"更新成功！",delay:1200},function(){								window.location = window.location;							});						}					}				});			}		});		return false;	}</script>
</div>

<script type="text/javascript" src="/Public/Admin/js/my.js"></script>
</body>
</html>